package com.ms.service.module.baccarat;

import com.xpec.c4.game.time.TimeConstants;
import com.xpec.c4.game.time.TimeSys;

public class BacrCombosData {
	/**
	 * 排行榜有效時間
	 */
	private static final long RANK_EXPERATION_TIME = 3600*1000L;
	
	/**
	 * 活動COMBO數
	 */
	private int activityCombos;
	
	/**
	 * 最後活動COMBO時間
	 */
	private long lastActivityComboTime;
	
	/**
	 * 排行榜COMBO數
	 */
	private int rankCombos;
	
	/**
	 * 最後排行榜COMBO時間
	 */
	private long lastRankComboTime;
	
	/**
	 * 活動COMBO有效時間(從表讀出來的有效時間)
	 */
	private long activityExperationTime;
	
	//---------------傳給CLIENT用的---------------
	/**
	 * 活動COMBO數
	 */
	private int activityCombos_ForClient;
	//---------------傳給CLIENT用的---------------
	
	/**
	 * 玩家名稱
	 */
	private String playerName;
	
	/**
	 * 判斷活動連勝時間是否有效
	 */
	public boolean isActivityTimeEffect(){
		long effectiveTime = lastActivityComboTime + activityExperationTime;
		if(effectiveTime >= TimeSys.currentTimeMills())
			return true;
		else return false;
	}
	
	/**
	 * 判斷排行榜連勝時間是否有效
	 */
	public boolean isRankTimeEffect(){
		long effectiveTime = lastRankComboTime + RANK_EXPERATION_TIME;
		if(effectiveTime >= TimeSys.currentTimeMills())
			return true;
		else return false;
	}
	
	/**
	 * 取得活動連勝有效時間
	 */
	public long getExperationTime(){
		return lastActivityComboTime + activityExperationTime;
	}

	public BacrCombosData(String playerName, long experationTime){
		activityCombos = 0;
		lastActivityComboTime = 0L;
		rankCombos = 0;
		lastRankComboTime = 0L;
		activityExperationTime = experationTime*1000;//表上的單位是：秒
		this.playerName = playerName;
	}
	
	public int getActivityCombos() {
		return activityCombos;
	}

	public void setActivityCombos(int activityCombos) {
		this.activityCombos = activityCombos;
	}

	public long getLastActivityComboTime() {
		return lastActivityComboTime;
	}

	public void setLastActivityComboTime(long lastActivityComboTime) {
		this.lastActivityComboTime = lastActivityComboTime;
	}

	public int getRankCombos() {
		return rankCombos;
	}

	public void setRankCombos(int rankCombos) {
		this.rankCombos = rankCombos;
	}

	public long getLastRankComboTime() {
		return lastRankComboTime;
	}

	public void setLastRankComboTime(long lastRankComboTime) {
		this.lastRankComboTime = lastRankComboTime;
	}

	public int getActivityCombos_ForClient() {
		return activityCombos_ForClient;
	}

	public void setActivityCombos_ForClient(int activityCombos_ForClient) {
		this.activityCombos_ForClient = activityCombos_ForClient;
	}

	public String getPlayerName() {
		return playerName;
	}

	public void setPlayerName(String playerName) {
		this.playerName = playerName;
	}

	public void setActivityExperationTime(long activityExperationTime) {
		this.activityExperationTime = activityExperationTime*TimeConstants.MILLI_SECOND_PRE_SECOND;
	}

}
